home *** CD-ROM | disk | FTP | other *** search
/ New Star Software Collection / NSS_Collection.iso / 3-004 ms visual basic pro 30 / disk8 / crvbxsam.fr_ / crvbxsam.bin
Text File  |  1993-04-27  |  6KB  |  204 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   5445
  5.    ClientLeft      =   1110
  6.    ClientTop       =   1380
  7.    ClientWidth     =   8370
  8.    Height          =   5850
  9.    Left            =   1050
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5445
  12.    ScaleWidth      =   8370
  13.    Top             =   1035
  14.    Width           =   8490
  15.    Begin CrystalReport Report1 
  16.       Connect         =   ""
  17.       CopiesToPrinter =   1
  18.       Destination     =   0  'Window
  19.       GroupSelectionFormula=   ""
  20.       Left            =   7560
  21.       PrintFileName   =   ""
  22.       PrintFileType   =   2  'Text
  23.       ReportFileName  =   "VBXMDB.RPT"
  24.       SelectionFormula=   ""
  25.       SessionHandle   =   0
  26.       Top             =   600
  27.       UserName        =   ""
  28.       WindowBorderStyle=   2  'Sizable
  29.       WindowControlBox=   -1  'True
  30.       WindowHeight    =   300
  31.       WindowLeft      =   100
  32.       WindowMaxButton =   -1  'True
  33.       WindowMinButton =   -1  'True
  34.       WindowParentHandle=   0
  35.       WindowTitle     =   ""
  36.       WindowTop       =   100
  37.       WindowWidth     =   480
  38.    End
  39.    Begin TextBox RangeEnd 
  40.       Height          =   285
  41.       Left            =   4080
  42.       TabIndex        =   2
  43.       Text            =   "   "
  44.       Top             =   3000
  45.       Width           =   1455
  46.    End
  47.    Begin TextBox RangeStart 
  48.       Height          =   285
  49.       Left            =   4080
  50.       TabIndex        =   1
  51.       Text            =   "   "
  52.       Top             =   2520
  53.       Width           =   1455
  54.    End
  55.    Begin CommandButton Print_Report 
  56.       Caption         =   "Print Report"
  57.       Height          =   495
  58.       Left            =   2160
  59.       TabIndex        =   3
  60.       Top             =   3960
  61.       Width           =   3375
  62.    End
  63.    Begin ComboBox OutputList 
  64.       Height          =   300
  65.       Left            =   2160
  66.       TabIndex        =   0
  67.       Text            =   "   "
  68.       Top             =   1680
  69.       Width           =   3735
  70.    End
  71.    Begin Label Label7 
  72.       Caption         =   "To:"
  73.       Height          =   255
  74.       Left            =   2880
  75.       TabIndex        =   8
  76.       Top             =   3000
  77.       Width           =   855
  78.    End
  79.    Begin Label Label6 
  80.       Caption         =   "From:"
  81.       Height          =   255
  82.       Left            =   2880
  83.       TabIndex        =   7
  84.       Top             =   2520
  85.       Width           =   735
  86.    End
  87.    Begin Label Label5 
  88.       Caption         =   "Order Number"
  89.       Height          =   255
  90.       Left            =   840
  91.       TabIndex        =   6
  92.       Top             =   2520
  93.       Width           =   1335
  94.    End
  95.    Begin Label Label2 
  96.       Caption         =   "Print Destination"
  97.       Height          =   255
  98.       Left            =   360
  99.       TabIndex        =   5
  100.       Top             =   1680
  101.       Width           =   1695
  102.    End
  103.    Begin Label Label1 
  104.       Caption         =   "Sample App using Crystal Reports Custom Control"
  105.       FontBold        =   -1  'True
  106.       FontItalic      =   0   'False
  107.       FontName        =   "MS Sans Serif"
  108.       FontSize        =   13.5
  109.       FontStrikethru  =   0   'False
  110.       FontUnderline   =   0   'False
  111.       Height          =   375
  112.       Left            =   240
  113.       TabIndex        =   4
  114.       Top             =   600
  115.       Width           =   7935
  116.    End
  117. End
  118. Dim StrBuffer As String * 250
  119.  
  120. Sub Form_Load ()
  121.     OutputList.AddItem "Window"
  122.     OutputList.AddItem "Printer"
  123.     OutputList.AddItem "File"
  124.     OutputList.Text = "Window"
  125.     RangeStart.Text = "1"
  126.     RangeEnd.Text = "9999"
  127. End Sub
  128.  
  129. Sub OutputList_Click ()
  130.     If OutputList.Text = "Printer" Then
  131.     Form2.Show
  132.     Else
  133.     If OutputList.Text = "File" Then
  134.     Form3.Show
  135.     End If
  136.     End If
  137. End Sub
  138.  
  139. Sub Print_Report_Click ()
  140.     
  141. '   Please note that several properties of Report1 have been set
  142. '   for this example. Select F4 ( Properties ) when the focus is on
  143. '   the Crystal Reports icon to view these properties.
  144.  
  145. '   For Example, the ReportName property has been set
  146. '   to vbxmdb.rpt. This report file was included in the
  147. '   Reports directory.
  148.  
  149. '   Set Report1 Destination property based on the output
  150. '   setting which the user has selected from the Combination
  151. '   box on the report entitled OutputList.
  152.  
  153.  
  154.     If OutputList.Text = "Window" Then
  155.     OutputDestination = 0
  156.     Else
  157.     If OutputList.Text = "Printer" Then
  158.         OutputDestination = 1
  159.         Report1.CopiesToPrinter = Number_Of_Copies
  160.     Else
  161.         If OutputList.Text = "File" Then
  162.         OutputDestination = 2
  163.         Report1.PrintFileName = Output_File_Name
  164.         Report1.PrintFileType = Output_File_Type
  165.         End If
  166.     End If
  167.     End If
  168.     Report1.Destination = OutputDestination
  169.  
  170.  
  171. '   Set the Record Selection formula based on the Starting
  172. '   and ending ranges
  173.  
  174.     FmlaText$ = "{detail.ORDERNUM} in '" + Trim(RangeStart.Text) + "' to '" + Trim(RangeEnd.Text) + "'"
  175.     Report1.SelectionFormula = FmlaText$
  176.  
  177. '   Set location of the database file to the location from
  178. '   which the user ran the app
  179.  
  180.     LocText$ = LCase(app.Path)
  181.     If Right$(app.Path, 1) <> "\" Then LocText$ = LocText$ + "\"  'handles the root
  182.     Report1.DataFiles(0) = LocText$ + "crystal.mdb"
  183.     Report1.ReportFileName = LocText$ + "vbxmdb.rpt"
  184.  
  185. '   EXECUTE PRINT CALL
  186.     On Error GoTo ErrorHandler
  187.     Report1.Action = 1
  188.       Exit Sub
  189. ErrorHandler:
  190.     MsgBox Error$
  191.    Exit Sub
  192.   End Sub
  193.  
  194. Sub RangeEnd_GotFocus ()
  195.     RangeEnd.SelStart = 0
  196.     RangeEnd.SelLength = Len(RangeEnd.Text)
  197. End Sub
  198.  
  199. Sub RangeStart_GotFocus ()
  200.     RangeStart.SelStart = 0
  201.     RangeStart.SelLength = Len(RangeStart.Text)
  202. End Sub
  203.  
  204.